import { MockMethod } from "vite-plugin-mock";

const mock: Array<MockMethod> = [
  {
    //1.获取节日营销活动列表接口
    url: "/dev-api/api/v1/activity/festival/page",
    statusCode: 200,
    method: "get",
    response: () => {
      return {
        code: "00000",
        msg: "ok",
        data: {
          list: [
            {
              id: 1,
              name: "618会员活动",
              startTime: "2024-06-01 00:00:00",
              endTime: "2024-06-18 23:59:59",
              status: 0,
            },
            {
              id: 2,
              name: "双11促销活动",
              startTime: "2022-09-01 00:00:00",
              endTime: "2022-11-11 23:59:59",
              status: 3,
            },
          ],
          total: 2,
        },
      };
    },
  },

  {
    //2.获取优惠卷列表接口
    url: "/dev-api/api/v1/coupon/page",
    statusCode: 200,
    method: "get",
    response: () => {
      return {
        code: "00000",
        msg: "ok",
        data: {
          list: [
            {
              id: 1,
              name: "618活动优惠卷",
              type: 1, // 1 折扣卷 ， 2 满减卷
              discountInformation: "8折", // 优惠信息
              scope: 1, //使用范围 ： 0 部分商品， 1 全店商品
              numberLimit: 1, //限领次数
              designatedCrowd: 0, //0 不限人群， 1 会员用户， 2 普通用户
            },
            {
              id: 2,
              name: "双11活动优惠卷",
              type: 1, // 1 折扣卷 ， 2 满减卷
              discountInformation: "8折", // 优惠信息
              scope: 1, //使用范围 ： 0 部分商品， 1 全店商品
              numberLimit: 1, //限领次数
              designatedCrowd: 0, //0 不限人群， 1 会员用户， 2 普通用户
            },
            {
              id: 3,
              name: "周年庆会员优惠卷",
              type: 2, // 1 折扣卷 ， 2 满减卷
              discountInformation: "满 100 减 25", // 优惠信息
              scope: 1, //使用范围 ： 0 部分商品， 1 全店商品
              numberLimit: 1, //限领次数
              designatedCrowd: 1, //0 不限人群， 1 会员用户， 2 普通用户
            },
          ],
          total: 3,
        },
      };
    },
  },

  {
    //3.保存节日营销活动接口
    url: "/dev-api/api/v1/activity/festival",
    statusCode: 200,
    method: "post",
    response: () => {
      return {
        code: "00000",
        msg: "ok",
      };
    },
  },

  {
    //4.1.编辑节日营销活动时, 根据id获取对应信息的接口
    url: "/dev-api/api/v1/activity/festival/:id",
    statusCode: 200,
    method: "get",
    response: () => {
      return {
        code: "00000",
        msg: "ok",
        data: {
          id: 1,
          name: "dssdaf",
          startTime: "2024-06-01 00:00:00",
          endTime: "2024-06-18 23:59:59",
          distributionTime: "2024-05-28 12:00:00", // 初始化时, 根据 startTime 减去 distributionTime [2023-04-31 08:00:00] 得出 N 天后, 得到 前 N 天, 根据distributionTime截取得到  "08:00"
          configs: [
            {
              membershipLevel: 1,
              freeShipping: 0,
              point: 80,
              status: 1,
              couponIds: [1],
            },
            {
              membershipLevel: 2,
              freeShipping: 1,
              point: 80,
              status: 0,
              couponIds: [1, 3],
            },
          ],
        },
      };
    },
  },

  {
    //4.2.编辑节日营销活动接口
    url: "/dev-api/api/v1/activity/festival",
    timeout: 5000,
    statusCode: 200,
    method: "put",
    response: () => {
      return {
        code: "00000",
        msg: "ok",
      };
    },
  },
];

export default mock;
